vim.g.mapleader = " "

local keymap = vim.keymap

-- ---------- 插入模式 ---------- ---

-- ---------- 视觉模式 ---------- ---
-- 单行或多行移动
keymap.set("v", "J", ":m '>+1<CR>gv=gv")
keymap.set("v", "K", ":m '<-2<CR>gv=gv")

-- ---------- 正常模式 ---------- ---
-- 窗口
keymap.set("n", "<leader>sv", "<C-w>v") -- 水平新增窗口 
keymap.set("n", "<leader>sh", "<C-w>s") -- 垂直新增窗口

-- 取消高亮
keymap.set("n", "<leader>nh", ":nohl<CR>")

-- 切换buffer
keymap.set("n", "<C-,>", ":bnext<CR>")
keymap.set("n", "<C-.>", ":bprevious<CR>")

-- 注释
keymap.set("n", "gc", '<Cmd>call VSCodeNotify("editor.action.commentLine")<CR>')
keymap.set("n", "gd", '<Cmd>call VSCodeNotify("editor.action.revealDefinitionAside")<CR>')
keymap.set('n', 'gC', '<Cmd>call VSCodeNotify("editor.action.blockComment")<CR>')


-- ---------- 插件 ---------- ---
-- nvim-tree
--vim-tranlator
-- nvim-lspconfig
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
-- keymap.set('n', '<space>e', vim.diagnostic.open_float)
keymap.set('n', '[d', '<Cmd>call VSCodeNotify("editor.action.marker.prevInFiles")<CR>')
keymap.set('n', ']d', '<Cmd>call VSCodeNotify("editor.action.marker.nextInFiles")<CR>')
keymap.set('n', '<space>q', vim.diagnostic.setloclist)

-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer

